package com.zyh.properties;

import java.util.Properties;
import java.util.Set;

/**
 * @Author zyh
 * @Date 2024/8/6 16:22
 * @Description properties 集合
 */

public class PropertiesDemo1 {
    public static void main(String[] args) {
        Properties prop = new Properties();
        //CRUD
        prop.setProperty("zyh","123");
        prop.setProperty("cxk","篮球");
        prop.setProperty("dz","维新悦刻5");
        prop.setProperty("wy","传统芙蓉王");
        System.out.println("prop = " + prop);
        //删除
        prop.remove("zyh");
        System.out.println("prop = " + prop);
        //修改
        prop.setProperty("wy","芙蓉王源");
        System.out.println("prop = " + prop);
        //遍历
        Set<String> keys = prop.stringPropertyNames();
        for (String key : keys) {
            System.out.println(key+"--"+prop.getProperty(key));
        }
    }
}
